<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:93:"D:\PHPStudy\PHPTutorial\WWW\HM\pdingzone\public/../application/core\view\site\module\all.html";i:1544678555;s:84:"D:\PHPStudy\PHPTutorial\WWW\HM\pdingzone\application\core\view\common\pc\header.html";i:1544678555;s:84:"D:\PHPStudy\PHPTutorial\WWW\HM\pdingzone\application\core\view\common\pc\footer.html";i:1544678555;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>模块列表 - <?php echo $siteConfig['siteName']; ?></title>
    <meta name="keywords" content="<?php echo $siteConfig['siteKeyword']; ?>"/>
    <meta name="description" content="<?php echo $siteConfig['siteDesc']; ?>"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link href="<?php echo $siteConfig['favicon']; ?>" type="image/x-icon" rel="shortcut icon"/>
    <link rel="stylesheet" href="/static/layui/2.4.3/src/css/layui.css?v=20181010_1" media="all">
    <link rel="stylesheet" href="//at.alicdn.com/t/font_731151_u29ky3lpahq.css?v=20181010_1" media="all">
    <link rel="stylesheet" href="/static/css/pc.css?v=20181010_1" media="all">
    <script src="/static/js/jquery.min.js?v=20181010_1" charset="utf-8"></script>
    <script src="/static/layui/2.4.3/src/layui.js?v=20181010_1" charset="utf-8"></script>
    <script src="/static/js/common.js?v=20181010_1" charset="utf-8"></script>
    <script src="/static/js/pc.js?v=20181010_1" charset="utf-8"></script>

    <?php if($siteConfig['theme']): ?>
    <link rel="stylesheet" href="/static/css/theme/<?php echo $siteConfig['theme']; ?>/pc.css?v=20181010_1" media="all">
    <?php endif;  if(\think\App::$debug){  ?>
    <!-- 调试窗口 -->
    <script src="/static/js/vconsole/vconsole.min.js?v=20181010_1" charset="utf-8"></script>
    <script>
        // 调试窗口初始化
        new VConsole();
    </script>
    <?php  }  ?>
</head>

<body class="layui-layout-body pc-body">

<script>
    window.reload_when_tab_focus = true;
</script>
<style>
    #modules-table img {
        width: 60px;
        height: 60px;
    }
    #modules-table a.layui-btn {
        width: 70px;
        display: block;
        margin-right: 0px;
    }
</style>
<form action="#" class="layui-form">
    <table class="layui-table" id="modules-table">
        <colgroup>
            <col width="20">
            <col width="60">
            <col width="120">
            <col width="80">
            <col width="200">
            <col width="100">
            <col>
            <col width="150">
            <col width="250">
            <col width="200">
        </colgroup>
        <thead>
        <tr>
            <th>ID</th>
            <th>Logo</th>
            <th>模块标识</th>
            <th>版本</th>
            <th>模块名称</th>
            <th>模块状态</th>
            <th>模块介绍</th>
            <th>模块作者</th>
            <th>管理</th>
        </tr>
        </thead>
        <tbody>
        <?php if(is_array($modules) || $modules instanceof \think\Collection || $modules instanceof \think\Paginator): $i = 0; $__LIST__ = $modules;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$module): $mod = ($i % 2 );++$i;?>
        <tr>
            <td>
                <?php if(isset($module['id'])): ?>
                <?php echo $module['id']; endif; ?>
            </td>
            <td>
                <img src="/<?php echo $module['name']; ?>/logo.png" onerror="this.src='/static/images/module.png';"/>
            </td>
            <td>
                <?php echo $module['name']; ?>
            </td>
            <td>
                <?php echo $module['version']; ?>
            </td>
            <td>
                <?php echo $module['title']; ?>
            </td>
            <td>
                <?php if($module['status'] == 'inactive'): ?>
                <span class="layui-badge layui-bg-orange">未启用</span>
                <?php elseif($module['status'] == 'active'): ?>
                <span class="layui-badge layui-bg-green">已启用</span>
                <?php elseif($module['status'] == 'uninstall' || $module['status'] == 'undownload'): ?>
                <span class="layui-badge layui-bg-red">未安装</span>
                <?php endif; ?>
            </td>
            <td>
                <?php echo $module['description']; ?>
            </td>
            <td>
                <?php echo $module['author']; ?>
                <br/>
                <a href="<?php echo $module['url']; ?>" target="_blank"><?php echo $module['url']; ?></a>
            </td>
            <td align="center">
                <a class="layui-btn layui-btn-sm layui-btn-normal" href="javascript:;"
                   onclick="openModuleDetailTab('<?php echo $module['title']; ?>','<?php echo $module['name']; ?>')">模块管理</a>
                <?php if($module['status'] == 'inactive'): ?>
                <a class="layui-btn layui-btn-sm layui-btn-success" href="javascript:;"
                   onclick="openModuleDetailTab('<?php echo $module['title']; ?>','<?php echo $module['name']; ?>','active')">启用模块</a>
                <a class="layui-btn layui-btn-sm layui-btn-danger" href="javascript:;"
                   onclick="openModuleDetailTab('<?php echo $module['title']; ?>','<?php echo $module['name']; ?>','uninstall')">卸载模块</a>
                <?php elseif($module['status'] == 'active'): ?>
                <a class="layui-btn layui-btn-sm layui-btn-warm" href="javascript:;"
                   onclick="openModuleDetailTab('<?php echo $module['title']; ?>','<?php echo $module['name']; ?>','inactive')">停用模块</a>
                <?php elseif($module['status'] == 'undownload' || $module['status'] == 'uninstall'): ?>
                <a class="layui-btn layui-btn-sm" href="javascript:;"
                   onclick="openModuleDetailTab('<?php echo $module['title']; ?>','<?php echo $module['name']; ?>','install')">安装模块</a>
                <?php endif; ?>
            </td>
        </tr>
        <?php endforeach; endif; else: echo "" ;endif; ?>
        </tbody>
    </table>
</form>

<script>
    layui.use('form', function () {
        var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
        form.render();
    });

    function openModuleDetailTab(title, moduleName, initAction) {
        var link = "/core/site.module/detail/" + moduleName + "?init=" + initAction;
        if (window.parent && window.parent.openTab) {
            window.parent.openTab("模块管理 - " + title, link, "site_module_" + moduleName);
        } else {
            window.location.href = link;
        }
    }
</script>

<?php 
if(isset($_enterprise_js_css_customize)) {
echo $_enterprise_js_css_customize;
}
 ?>
</body>
</html>